#!/usr/local/bin/python3.6
# coding:utf-8
# @Time    : 2019/11/20 8:59
# @Author  : ZhangBing
# @Email   : 18829272841@163.com
# @File    : webserver.py
# @Software: PyCharm

import asyncio
import websockets


async def echo(websocket, path):
    async for message in websocket:
        print(message)
        await websocket.send(message)


start_server = websockets.serve(echo, "localhost", 8765)

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()

if __name__ == "__main__":
    pass
